<div class="SipeiInfo pt20">
<?php $form=$this->beginWidget('CActiveForm', array('id'=>'myform','htmlOptions'=>array('name'=>'myform','target'=>'ajax-frame'))); ?>
<table class="fontc_666 height32">
    <tbody>
        <tr height="55">
            <td valign="top" width="125" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>考试项目：</td>
            <td valign="top" width="370" class="formValidator_td">            
                <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                    <span class="fl select_shelter">
                        <select class="fl fontc_666" name="exam_id" id="exam_id">
                            <option value="">考试项目</option>
                            <?php if (!empty($examArray)): ?>
                                <?php foreach ($examArray as $eVal): ?>
                                <option value="<?php echo $eVal['exam_id']; ?>" <?php if($eVal['exam_id'] == $data['exam_id']): ?>selected<?php endif; ?>><?php echo $eVal['exam_term_name']; ?></option>
                                <?php endforeach; ?>
                            <?php endif; ?>
                        </select>
                    </span>
                </span>
                <div class="formValidator_tip">
                    <p id="exam_idTip" ></p>
                </div>
            </td>
        </tr>
        <tr height="55">
            <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>下限：</td>
            <td valign="top" class="formValidator_td">
                <input type="text" value="<?php echo $data['score_type1']; ?>" name="stype1" id="stype1" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666">
            	<div class="formValidator_tip">
                    <p id="stype1Tip" ></p>
                </div>
            </td>
        </tr>
        <tr height="55">
            <td valign="top" align="right" valign="top" class="pr5"><span class="pr5 fontc_orange_red">*</span>上限：</td>
            <td valign="top" class="formValidator_td">
                <input type="text" value="<?php echo $data['score_type2']; ?>" name="stype2" id="stype2" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666">
            	<div class="formValidator_tip">
                    <p id="stype2Tip" ></p>
                </div>
            </td>
        </tr>
        <tr height="60">
            <td valign="top" align="right" valign="top" class="pr5"><span class="pr5 fontc_orange_red">*</span>级差：</td>
            <td valign="top" class="formValidator_td">
                <input type="text" value="<?php echo $data['score_type3']; ?>" name="stype3" id="stype3" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666">
            	<div class="formValidator_tip">
                    <p id="stype3Tip" ></p>
                </div>
            </td>
        </tr>
        <tr>
            <td align="right" class="pr2 pb20"></td>
            <td class="pb20">
                <input type="hidden" name="sid" value="<?php echo $sid; ?>"/>
                <input type="submit" value="保存" class="cursor b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 mr10">
                <input type="button" value="取消" onClick="api.close()" class="cursor b_a_n border_3 back_bgb w80 height32 fontc_FFF fonts_12">
            </td>
        </tr>
    </tbody>
</table>
</div>
<?php $this->endWidget(); ?>
<iframe src='' style="display:none" name='ajax-frame'></iframe>
<script>
$(function(){
	$.formValidator.initConfig({formID:"myform",theme:"126",submitOnce:false,
	onError:function(msg,obj,errorlist){
		$("#errorlist").empty();
		$.map(errorlist,function(msg){
			$("#errorlist").append("<li>" + msg + "</li>")
		});
		alert(msg);
	},
	ajaxPrompt : '有数据正在异步验证，请稍等...'
	});

	/*分数段规则验证*/
	$("#exam_id").formValidator({
		onShowText:"",
		onShow:"",
		onFocus:"",
		onCorrect:"选择正确"
	}).inputValidator({
		min:1,
		onError:"请选择考试项目"
	});

	/*下限分数验证*/
	$("#stype1").formValidator({
		onShowText:"请输入下限分数",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		onError:"下限分数不能为空"
	}).regexValidator({
		regExp:"num",
		dataType:"enum",
		onError:"分数格式不正确"
	}).functionValidator({
		fun:stype1
	});

	/*上限分数验证*/
	$("#stype2").formValidator({
		onShowText:"请输入上限分数",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		onError:"上限分数不能为空"
	}).regexValidator({
		regExp:"num",
		dataType:"enum",
		onError:"分数格式不正确"
	}).functionValidator({
		fun:stype2
	});

	/*极差分数验证*/
	$("#stype3").formValidator({
		onShowText:"请输入极差分数",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		onError:"极差分数不能为空"
	}).regexValidator({
		regExp:"num",
		dataType:"enum",
		onError:"分数格式不正确"
	}).functionValidator({
		fun:stype3
	});

	function stype1( val  ){
		var msg="";
		if( $.trim($("#stype2").val()) == "" ){
			msg = true;
		}else if( parseInt($.trim($("#stype2").val())) == 0 ){
			msg = "下限分数必须大于0";
		}else if( parseInt(val) > parseInt($.trim($("#stype2").val())) ){
			msg = "下限分数不能大于上限分数";
		}else{
			msg = true;
		}
		return msg;
	}
	function stype2( val  ){
		var msg="";
		if( $.trim($("#stype1").val()) == "" ){
			msg = true;
		}else if( parseInt($.trim($("#stype1").val())) == 0 ){
			msg = "上限分数必须大于0";
		}else if( parseInt(val) < parseInt($.trim($("#stype1").val())) ){
			msg = "上限分数不能小于上限分数";
		}else{
			msg = true;
		}
		return msg;
	}
	function stype3( val  ){
		var msg="";
		if( $.trim($("#stype2").val()) == "" ){
			msg = true;
		}else if( $.trim($("#stype2").val()) == 0 ){
			msg = "极差分数必须大于0";
		}else if( val > $.trim($("#stype2").val()) ){
			msg = "极差分数不能大于上限分数";
		}else{
			msg = true;
		}
		return msg;
	}
})
</script>
<?php exit; ?>